package cn.yeyiu.videoplayer;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;


public abstract class IControlView{
    public final Activity mActivity;
    public View rootView;

    public TextView title;
    public ImageView back;
    public ImageView share;
    public ImageView play;
    public View progress;
    public View progress_cur;
    public TextView time_cur;
    public TextView time_max;

    public IControlView(Activity activity, int layout) {
        mActivity = activity;
        rootView = LayoutInflater.from(activity).inflate(layout, null);
        bindBaseView();
    }

    private void bindBaseView(){
        title = rootView.findViewById(R.id.video_header_title);
        back = rootView.findViewById(R.id.video_header_back);
        share = rootView.findViewById(R.id.video_share);
        play = rootView.findViewById(R.id.video_play);
        progress = rootView.findViewById(R.id.video_progress);
        progress_cur = rootView.findViewById(R.id.video_progress_cur);
        time_cur = rootView.findViewById(R.id.video_time_cur);
        time_max = rootView.findViewById(R.id.video_time_max);
    }


    public void show(){
        rootView.setVisibility(View.VISIBLE);
    }

    public void hide(){
        rootView.setVisibility(View.INVISIBLE);
    }

    public void start(){
        play.setImageResource(R.drawable.ic_pause);
    }
    public void pause(){
        play.setImageResource(R.drawable.ic_play);
    }
}
